package com.wyp.microservice.t.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


import com.wyp.microservice.t.mapper.BlogMapper;
import com.wyp.microservice.t.model.Blog;
import com.wyp.microservice.t.service.BlogService;

/**
 * @Description: 
 * @Author:  wyp
 * @Date: 2020-11-15 16:14:12
 * @Copyright: Fujian Linewell Software Co., Ltd. All rights reserved.
 */
@Service("blogService")
public class BlogServiceImpl implements BlogService {
    @Autowired
    private BlogMapper blogMapper;

    @Override
    public Blog getBlog(Long id) {
        return blogMapper.selectByPrimaryKey(id);
    }

    @Override
    public void deleteBlog(List<Long> ids) {
        blogMapper.deleteBatch(ids);
    }

    @Override
    public List<Blog> getBlogList(Long id, String title, String content, String firstPicture, Short flag, Integer views, Short appreciation, Short notice, Short shareStatement, Short carousel, Short comment, Short published, Short recommend, Short headline, Date createTimeBegin, Date createTimeEnd, Date updateTimeBegin, Date updateTimeEnd, Long typeId, Long userId, String description, String tagIds) {
        return blogMapper.queryList(id, title, content, firstPicture, flag, views, appreciation, notice, shareStatement, carousel, comment, published, recommend, headline, createTimeBegin, createTimeEnd, updateTimeBegin, updateTimeEnd, typeId, userId, description, tagIds);
    }

    @Override
    public Blog addBlog(Blog blog) {
        blogMapper.insertSelective(blog);
        return blog;
    }

    @Override
    public Blog updateBlog(Blog blog) {
        blogMapper.updateByPrimaryKeySelective(blog);
        return blog;
    }
}
